$(function() {
	$(".Pnav_title").live("click", function() {
		var point = $(this).find("span"); 
		var p_id = point.attr("menuId");
		var node = $(this); 
			if (point.attr("hasLoad") == "false") {
				if (node.next().html == "") {
					 
		   } else { 
				node.append('<div id="markuper' + p_id + '"></div>');
				ajaxLoadMenus("#markuper"+ p_id,
						p_id, function(data) {
							BuildChildMenus(data, node.next(".Pnav_item"));
						});
				point.attr("hasLoad", "true");
		   }
	   } // end if
	}); // end of .Pnav_title

	$(".Node").live(
			"click",
			function() {

				var mySelf = $(this);

				var hasLoad = mySelf.attr("hasLoad");

				var p_id = mySelf.attr("menuId");

				if (hasLoad == "true")
					return;
				mySelf.append('<div id="markuper' + p_id + '"></div>');
				ajaxLoadMenus("#markuper" + p_id, p_id, function(data) {
					var hasNodes = BuildGrandSon(data, mySelf
							.next(".childNodes"));
					mySelf.attr("hasnode", hasNodes);
					mySelf.attr("hasLoad", "true");
				});
			});

	loadRootMenus();
});

function loadRootMenus() {
	ajaxLoadMenus("#MainMenuTips", 0, function(data) {
		buildRootMenuItems(data);
		$(".Pnav_title").first().click();
	}); 
	
}

function InitialLeftMenu() {
	document.location.reload();
}
